<?php
include ("../include/config.inc.php");
include ("../include/function.inc.php");
require_once '../lib/bbcode/bbcode.lib.php';

echo "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>
<rss version=\"2.0\">
<channel>
<title>ЕТК ВГТУ</title>
<link>http://etk.org.ru</link>
<description><![CDATA[Новости ЕТК ВГТУ]]></description>
<language>ru</language>
<managingEditor>admin@etk.org.ru</managingEditor>
	<generator>etk.org.ru</generator>
	<lastBuildDate></lastBuildDate>
	<image>
		<link>http://etk.org.ru/</link>
		<url>http://etk.org.ru/images/gerb.png</url>
		<title>ЕТК ВГТУ</title>
	</image>
	";
$result_rss = mysql_query("SELECT *, UNIX_TIMESTAMP(date_news) AS date_news 
    FROM news ORDER BY date_news DESC LIMIT 0,1");
//...
$ei = mysql_fetch_assoc($result_rss);
//date("r",$ei['date_news'])

echo "<lastBuildDate>".date("r",$ei['date_news'])."</lastBuildDate>
	<pubDate>".date("r",$ei['date_news'])."</pubDate>
";

$result = sql_query("SELECT * FROM news ORDER BY id_news DESC LIMIT 0,10");
while ($data = mysql_fetch_array($result)) {
echo "

<item>
";
echo "<title>".$data['subject_news']."</title>
";
echo "<link>http://etk.org.ru/page/news.php?block=".$data['id_news']."</link>
";
echo "<description><![CDATA[
".$data['text_news']."<br><div style='float:right'>".$data['date_news']."</div>
]]></description>
";

$id=$data['id_news'];
$result_rss = mysql_query("SELECT *, UNIX_TIMESTAMP(date_news) AS date_news 
    FROM news WHERE  id_news=$id");
//...
$ei = mysql_fetch_assoc($result_rss);
//date("r",$ei['date_news'])
echo "<pubDate>".date("r",$ei['date_news'])."</pubDate>
";
echo "<guid>".$data['id_news']."</guid>
";
echo "</item>
";
}
?>

<item>
<title>Хостинг</title>
<link>http://eomy.net</link>
<description><a href="http://www.eomy.net/">
<img src="http://www.eomy.net/eomy.net.gif" border="0" alt="EOMY.NET: бесплатный хостинг без рекламы"/><!--eomy-->
EOMY.NET</a></description>

<pubDate>Thu, 01 Jan 1970 01:00:00 +0100</pubDate>
<guid>host</guid>
</item>

</channel>
</rss>